<!DOCTYPE html>
<html>

	<head>
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
		<meta id="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">
		<meta name="apple-themes-web-app-capable" content="yes">
		<meta content="yes" name="apple-mobile-web-app-capable">
		<meta content="black" name="apple-mobile-web-app-status-bar-style">
		<meta content="telephone=no" name="format-detection">
		<meta content="email=no" name="format-detection">
		<meta name="format-detection" content="telephone=no">
		<title>注册</title>
		<link rel="stylesheet" href="${s.base}/mobile/css/main.css" type="text/css" media="all">
	</head>

	<body> 
		<header id="header">
			<div class="header_con">
            	<a href="javascript:history.go(-1);"><span></span></a> 
                <div class="top_tit">注册</div>         
			</div>
		</header>
		<input type="hidden" value="${memberId}" id="memberId" />
		<div id="content_div">
             <div class="pay_02">
              <p class="border_bottom">登录名：<input type="text" id="phone" style="width: 80%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: left;" placeholder="请输入注册手机号" /></p>
               <p class="border_bottom">验证码：
				   <input type="text" id="validate" style="width: 50%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: left;" placeholder="请输入验证码" />
				   <input type="button"  style="width: 27%;height: 0.6rem;line-height: 0.6rem;border: 0px; border-radius:5px; border:1px solid #F00; background:#FFF;" value="获取验证码"/>
				   <input type="hidden" id="oldVerifyCode" />
			   </p>

               <p class="border_bottom">密&nbsp;&nbsp;&nbsp;&nbsp;码：<input type="password" id="password" style="width: 80%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: left;" placeholder="请输入密码" /></p>
               <p class="border_bottom">推荐人：<input type="text" id="introductUserId" style="width: 80%;height: 0.8rem;line-height: 0.8rem;border: 0px; text-align: left;" placeholder="请输入推荐人" /></p>
             </div>
             
              <div class="pay_04 margin_top_1"><a class="ui-btn" href="javascript:void(0)" id="reg">立即注册</a></div>
             
        
      </div>	
		<script src="${s.base}/mobile/js/jquery-1.7.2.min.js"></script>
		<script type="text/javascript" src="${s.base}/mobile/js/common.js"></script>
		<script type="text/javascript" src="${s.base}/js/layer/layer.js"></script>
		<script type="text/javascript" src="${s.base}/js/base/commont.js"></script>
		<script>
            $("#reg").click(function(){
                var phone = $("#phone").val();
                var password = $("#password").val();
                var introductUserId = $("#introductUserId").val();
                if (phone == null || phone == ""){
                    layer.alert("您必须输入注册手机号");
                    return false;
                }
                if (password == null || password == ""){
                    layer.alert("您必须输入登录密码");
                    return false;
                }
                $.post("/phone/registe",{
                    phone : phone,
                    password : password,
                    id : $("#memberId").val(),
                    introductUserId : introductUserId
                },function(result){
                    if(result.code=="success"){
                        location.href=result.url;
                    }else{
                        showLayerAlertNoReload(result.errorMsg);
                    }
                },"json");
                return false;
            });

            $("#verify").on("click",function () {
                var phone = $("#phone").val();
                if (phone == null || phone == ""){
                    layer.alert("请输入手机号");
                    return false;
                }
                timer(60);
                $.post("/phone/verifyCodeNoMember",{
                    phone : phone
                },function(result){
                    if(1==result.returnInfo.state){
                        $("#oldVerifyCode").val(result.returnInfo.errorMsg);
                        layer.alert("发送成功！");
                    }else{
                        layer.alert(result.returnInfo.errorMsg+"，请重试！");
                    }
                },"json");
            });

            function timer(time) {
                var btn = $("#verify");
                btn.attr("disabled", true);  //按钮禁止点击
                btn.val(time <= 0 ? "获取验证码" : ("" + (time) + "秒后可发送"));
                var hander = setInterval(function() {
                    if (time <= 0) {
                        clearInterval(hander); //清除倒计时
                        btn.val("获取验证码");
                        btn.attr("disabled", false);
                        return false;
                    }else {
                        btn.val("" + (time--) + "秒后可发送");
                    }
                }, 1000);
            }
		</script>

	</body>

</html>